約 3,963,021 件
https://w.atwiki.jp/ce00582/pages/3102.html
JAVA GAME 06 JAVA game06.jar 1月29日 プログラム作成
https://w.atwiki.jp/ce00582/pages/3147.html
JAVA GAME 10 紙芝居 JAVA
https://w.atwiki.jp/sevenlives/pages/632.html
配列(Java) 読み:はいれつ 英語:Array 別名: 意味: 配列とは連続したデータを複数持つ構造のこと。 データを一元的に扱うためにあります。 Javaの配列は型か変数に[]をつけたものが配列と認識し、オブジェクトとして宣言し初期化の時に同時にサイズも決めます。 型[] 配列名; 配列名 = new 型[サイズ]; 型[] 配列名 = new 型[サイズ]; 例: int[] nums = new int[3]; int nums[] = new int[3]; String[] str = new String[5]; サイズは不変で{}を使った配列定数?によっても初期化できます。 例: String[] str = {"ABC", "DEF", "GHI"}; 2007年09月16日 配列定数(Java)? 多次元配列?ジャグ配列(Java)?
https://w.atwiki.jp/ce00582/pages/3154.html
JAVA GAME 13 (1)プログラム JAVA game13.jar (2)コメント 侵略者ほぼ完成。 (3)作業記録 1月31日 ページ作成
https://w.atwiki.jp/ce00582/pages/1100.html
class tax{ public static void main(String args[]){ double th[]= new double[101]; double c[]= new double[101]; double y[]= new double[101]; int opc[]= new int[101]; int opy[]= new int[101]; int opq[]= new int[101]; double u[][][]=new double[101][3][3]; double ww[][][]=new double[100][3][3]; double v[][][][]=new double[100][3][3][21]; int gotoc[][][][]=new int[100][3][3][21]; int gotoy[][][][]=new int[100][3][3][21]; int gotoq[][][][]=new int[100][3][3][21]; double endv[][]=new double[3][3]; int endc[][]=new int[3][3]; int endy[][]=new int[3][3]; int endq[][]=new int[3][3]; int s; double tl; double tr; double ls; double w; double cs; double ys; double b1; double b2; double tr1; double tr2; double tr3; double wel; double maxwel; double maxtl; double maxtr; int t; int n; int n1; int n2; int pp; int q; int j; double c1; double l1; double h; double u1; int ns1; int ns2; int qx; int nx1; int nx2; double vs; double v1; double maxv; double dc; double dy; int e; for (s=1;s 101;s++){ th[s]=0.02*s; } maxtl=0; maxwel=-999; maxtr=0; for (n=20;n 45;n++){ tl=0.01*n; tr1=0.01; tr2=0.02; b1=bud(tl,tr1,th); t=0; while (t 100) { b2=bud(tl,tr2,th); tr3=tr2-b2*(tr2-tr1)/(b2-b1); tr1=tr2; tr2=tr3; b1=b2; if (b2*b2 0.00001)t=1000; t=t+1; } tr=tr2; wel=seekwel(tl,tr,th); if (wel maxwel)maxtl=tl; if (wel maxwel)maxtr=tr; if (wel maxwel)maxwel=wel; } tl=maxtl; tr=maxtr; for (s=1;s 101;s++){ w=(1-tl)*th[s]; ls=(w-tr)/(2*w); if (ls 0)ls=0; c[s]=w*ls+tr; y[s]=th[s]*ls; } h=0.001; t=0; while(t 1000){ for (s=1;s 101;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ c1=c[s]+n1*h; l1=(y[s]+n2*h)/th[s]; u1=ux(c1,l1); u[s][n1+1][n2+1]=u1; } } } for (s=1;s 100;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ c1=c[s]+n1*h; l1=(y[s]+n2*h)/th[s+1]; u1=ux(c1,l1); ww[s][n1+1][n2+1]=u1; } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ for (q=-10;q 11;q++){ v[1][n1+1][n2+1][q+10]=-999; } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ q=n2-n1; v[1][n1+1][n2+1][q+10]=u[1][n1+1][n2+1]; } } for (s=2;s 100;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ for (q=-10;q 11;q++){ u1=u[s][n1+1][n2+1]; qx=q-n1+n2; pp=0; if (qx 10){ pp=100; } if (qx -10){ pp=100; } if (pp 50){ qx=0; } vs=-999; ns1=0; ns2=0; for (nx1=-1;nx1 2;nx1++){ for (nx2=-1;nx2 2;nx2++){ v1=u1+v[s-1][nx1+1][nx2+1][qx+10]; if (ww[s-1][nx1+1][nx2+1] u1){ v1=-999; } if (v1 vs){ ns1=nx1; } if (v1 vs){ ns2=nx2; } if (v1 vs){ vs=v1; } } } if (pp 50){ vs=-999; } gotoc[s][n1+1][n2+1][q+10]=ns1; gotoy[s][n1+1][n2+1][q+10]=ns2; gotoq[s][n1+1][n2+1][q+10]=qx; v[s][n1+1][n2+1][q+10]=vs; } } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ u1=u[100][n1+1][n2+1]; qx=n2-n1; vs=-999; ns1=0; ns2=0; for (nx1=-1;nx1 2;nx1++){ for (nx2=-1;nx2 2;nx2++){ v1=u1+v[99][nx1+1][nx2+1][qx+10]; if (ww[99][nx1+1][nx2+1] u1){ v1=-999; } if (v1 vs){ ns1=nx1; } if (v1 vs){ ns2=nx2; } if (v1 vs){ vs=v1; } } } endc[n1+1][n2+1]=ns1; endy[n1+1][n2+1]=ns2; endq[n1+1][n2+1]=qx; endv[n1+1][n2+1]=vs; } } maxv=-999; ns1=0; ns2=0; for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ if (endv[n1+1][n2+1] maxv){ ns1=n1; } if (endv[n1+1][n2+1] maxv){ ns2=n2; } if (endv[n1+1][n2+1] maxv){ maxv=endv[n1+1][n2+1]; } } } opc[100]=ns1; opy[100]=ns2; opc[99]=endc[opc[100]+1][opy[100]+1]; opy[99]=endy[opc[100]+1][opy[100]+1]; opq[99]=endq[opc[100]+1][opy[100]+1]; for (j=1;j 99;j++){ s=99-j; opc[s]=gotoc[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; opy[s]=gotoy[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; opq[s]=gotoq[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; } e=0; for (s=1;s 101;s++){ e=e+opc[s]*opc[s]+opy[s]*opy[s]; } for (s=1;s 101;s++){ c[s]=c[s]+opc[s]*h; y[s]=y[s]+opy[s]*h; } System.out.println(e); if (e 2){ h=h/2; } if (h 0.00001){ t=10000; } t=t+1; } for (s=1;s 100;s++){ dy=y[s+1]-y[s]; dc=c[s+1]-c[s]; if (dy 0)System.out.println(1-dc/dy); } } static double ux(double c1,double l1){ double up; double c3; double l3; int pp; pp=0; c3=c1; l3=l1; if (c3 0)pp=100; if (l3 0)pp=100; if (l3 1)pp=100; if (pp 50)c3=0.5; if (pp 50)l3=0.5; up=Math.log(c3)+Math.log(1-l3); if (pp 50)up=-999; return up; } static double bud(double tl,double tr,double th[]){ double bx; int s; double w1; double y1; double c1; double l1; bx=0; for (s=1;s 101;s++){ w1=(1-tl)*th[s]; l1=(w1-tr)/(2*w1); if (l1 0)l1=0; y1=th[s]*l1; c1=w1*l1+tr; bx=bx+y1-c1; } return bx; } static double seekwel(double tl,double tr,double th[]){ double sw; int s; double w1; double l1; double c1; sw=0; for (s=1;s 101;s++){ w1=(1-tl)*th[s]; l1=(w1-tr)/(2*w1); if (l1 0)l1=0; c1=w1*l1+tr; sw=sw+ux(c1,l1); } return sw; } }
https://w.atwiki.jp/projecthikky/pages/38.html
JavaのSwingのHTMLパーサを使ってみた 結論 コード テストデータ 出力結果 結論 使いにくい。 タグ名とテキストは取得できるものの、属性値は取得できなかった。 属性値も取得できたわ ただ一部のホワイトスペースが一部出てないけど、posっていう文書の位置から取得しろってことかな 重複する半角スペースが省略される仕様なのをやってるだけか、ただ一部出来てないとこが・・・ とにかく半角スペースの復元は無理そう テキストデータの文字間の複数半角スペースも省略されてるからこれではどこが省略されてるか特定できない コード Hoge.java import javax.swing.text.html.parser.ParserDelegator;import javax.swing.text.html.HTMLEditorKit;import javax.swing.text.html.HTML;import javax.swing.text.MutableAttributeSet;import java.io.FileReader;import java.io.FileNotFoundException;import java.io.IOException;import javax.swing.text.BadLocationException;import java.util.Enumeration; class Hoge extends HTMLEditorKit.ParserCallback{ public static void main(String[] args) throws FileNotFoundException, IOException { Hoge hoge = new Hoge(); FileReader file = new FileReader("unko.html"); ParserDelegator pd = new ParserDelegator(); pd.parse(file, hoge, true); file.close(); } Hoge() { } public void flush() throws BadLocationException { } public void handleText(char[] data, int pos) { System.out.printf("handleText(%d) ", pos); System.out.print(data); System.out.println(" "); } public void handleComment(char[] data, int pos) { System.out.printf("handleComment(%d) ", pos); System.out.print(data); System.out.println(" "); } public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) { System.out.printf("handleStartTag(%d) ", pos); System.out.println(t); System.out.printf("Attributes %d\n", a.getAttributeCount()); for (Enumeration ? e = a.getAttributeNames(); e.hasMoreElements();) { Object key = e.nextElement(); System.out.print(key); System.out.print(" "); System.out.println(a.getAttribute(key)); System.out.println(key.getClass()); System.out.println(a.getAttribute(key).getClass()); } } public void handleEndTag(HTML.Tag t, int pos) { System.out.printf("handleEndTag(%d) ", pos); System.out.println(t); } public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) { System.out.printf("handleSimpleTag(%d) ", pos); System.out.println(t); System.out.printf("Attributes %d\n", a.getAttributeCount()); for (Enumeration ? e = a.getAttributeNames(); e.hasMoreElements();) { Object key = e.nextElement(); System.out.print(key); System.out.print(" "); System.out.println(a.getAttribute(key)); System.out.println(key.getClass()); System.out.println(a.getAttribute(key).getClass()); } } public void handleError(String errorMsg, int pos) { System.out.printf("handleError(%d) ", pos); System.out.println(errorMsg); } public void handleEndOfLineString(String eol) { System.out.print("handleEndOfLineString "); System.out.println(eol); }} テストデータ unko.html !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http //www.w3.org/TR/html4/strict.dtd" HTML HEAD !--[if IE 7] linkrel="stylesheet" type="text/css" href="/stylesheets/ie.css" / ![endif]-- META http-equiv="Content-Type" content="text/html; charset=Shift_JIS" TITLE /TITLE /HEAD BODY bgcolor="red" hoge ほげ~ /hoge unko value="123" AIUEO pre hoge /pre umi /unko aoi br / sor aa br p MANKO /p !-- ぶりぶりぶー -- chinko href="unko.html" / /BODY /HTML 出力結果 handleStartTag(91) html Attributes 0 handleStartTag(98) head Attributes 0 handleComment(108) [if IE 7] linkrel="stylesheet" type="text/css" href="/stylesheets/ie.css" / ![endif] handleSimpleTag(212) meta Attributes 2 content text/html; charset=Shift_JIS class javax.swing.text.html.HTML$Attribute class java.lang.String http-equiv Content-Type class javax.swing.text.html.HTML$Attribute class java.lang.String handleStartTag(284) title Attributes 0 handleEndTag(291) title handleEndTag(300) head handleStartTag(308) body Attributes 1 bgcolor red class javax.swing.text.html.HTML$Attribute class java.lang.String handleError(338) tag.unrecognized hoge ? ? handleSimpleTag(332) hoge Attributes 0 handleError(357) end.unrecognized hoge ? ? handleText(343) ほげ~ handleSimpleTag(349) hoge Attributes 1 endtag true class javax.swing.text.html.HTML$Attribute class java.lang.String handleError(364) tag.unrecognized unko ? ? handleError(376) invalid.tagatt value unko ? handleText(358) handleSimpleTag(358) unko Attributes 1 value 123 class javax.swing.text.html.HTML$Attribute class java.lang.String handleText(378) AIUEO handleStartTag(387) pre Attributes 0 handleText(392) hoge handleEndTag(401) pre handleError(421) end.unrecognized unko ? ? handleText(408) umi handleSimpleTag(413) unko Attributes 1 endtag true class javax.swing.text.html.HTML$Attribute class java.lang.String handleText(421) aoi handleSimpleTag(426) br Attributes 0 handleText(433) sor aa handleSimpleTag(442) br Attributes 0 handleStartTag(447) p Attributes 0 handleText(453) MANKO handleEndTag(458) p handleComment(463) ぶりぶりぶー handleError(495) tag.unrecognized chinko ? ? handleError(512) invalid.tagatt href chinko ? handleSimpleTag(487) chinko Attributes 1 href unko.html class javax.swing.text.html.HTML$Attribute class java.lang.String handleText(515) handleEndTag(528) body handleEndTag(536) html handleEndOfLineString
https://w.atwiki.jp/ce00582/pages/1105.html
class prob{ double[] ex1(){ double p; double mu; double sig; double yy; double th[]= new double[101]; int s; mu=0; sig=0.39; for (s=1;s 101;s++){ p=0.01*s-0.005; yy=seeky(p,mu,sig); th[s]=Math.exp(yy); } return th; } static double f(double x,double mu,double sig){ double pi,x1,x2,x3,fx; pi = 3.1415; x1=-Math.pow(x - mu,2) / (2*Math.pow(sig,2)); x2=Math.exp(x1); x3=sig*Math.pow(2*pi,0.5); fx=x2/x3; return fx; } static double g(double y,double mu, double sig){ double gx,h,x; int n,t; gx=0; h=0.001; t=(int)(y/h); for (n=-2000;n t;n++){ x=n*h; gx=gx+f(x,mu,sig)*h; } return gx; } static double seeky(double p,double mu,double sig){ double g1,g2,y1,y2,y3; int t; y1=0.4; y2=-0.2; g1=g(y1,mu,sig); t=0; while(t 100){ g2=g(y2,mu,sig); y3=y2+(p-g2)*(y2-y1)/(g2-g1); y1=y2; y2=y3; g1=g2; if (Math.pow(p-g2,2) 0.0001)t=1000; t=t+1; } return y2; } } class linear{ double[] ex2(){ double th[]= new double[101]; int s; double tl; double tr; double ls; double w; double cs; double ys; double b1; double b2; double tr1; double tr2; double tr3; double wel; double maxwel; double maxtl; double maxtr; int t; int n; double h; double c[]= new double[101]; double y[]= new double[101]; double data1[]=new double[101]; double data[]=new double[201]; int n1; int n2; prob ton =new prob(); data1=ton.ex1(); for (s=1;s 101;s++){ th[s]=data1[s]; } maxwel=-999; maxtr=0; maxtl=0; for (n=20;n 45;n++){ tl=0.01*n; tr1=0.01; tr2=0.02; tr=tr1; b1=bud(tl,tr1,th); t=0; while (t 100) { b2=bud(tl,tr2,th); tr3=tr2-b2*(tr2-tr1)/(b2-b1); tr1=tr2; tr2=tr3; b1=b2; if (b2*b2 0.00001)t=1000; t=t+1; } tr=tr2; wel=seekwel(tl,tr,th); if (wel maxwel)maxtl=tl; if (wel maxwel)maxtr=tr; if (wel maxwel)maxwel=wel; } tl=maxtl; tr=maxtr; for (s=1;s 101;s++){ w=(1-tl)*th[s]; ls=(w-tr)/(2*w); if (ls 0)ls=0; c[s]=w*ls+tr; y[s]=th[s]*ls; } for (s=1;s 101;s++){ data[s]=c[s]; data[s+100]=y[s]; } return data; } static double ux(double c1,double l1){ double u1; double c3; double l3; int pp; pp=0; c3=c1; l3=l1; if (c3 0)pp=100; if (l3 0)pp=100; if (l3 1)pp=100; if (pp 50)c3=0.5; if (pp 50)l3=0.5; u1=Math.log(c3)+Math.log(1-l3); if (pp 50)u1=-999; return u1; } static double bud(double tl,double tr,double th[]){ double bx; int s; double w; double y1; double c1; double l1; bx=0; for (s=1;s 101;s++){ w=(1-tl)*th[s]; l1=(w-tr)/(2*w); if (l1 0)l1=0; y1=th[s]*l1; c1=w*l1+tr; bx=bx+y1-c1; } return bx; } static double seekwel(double tl,double tr,double th[]){ double sw; int s; double w; double l1; double c1; sw=0; for (s=1;s 101;s++){ w=(1-tl)*th[s]; l1=(w-tr)/(2*w); if (l1 0)l1=0; c1=w*l1+tr; sw=sw+ux(c1,l1); } return sw; } } class tax{ public static void main(String args[]){ double th[]= new double[101]; double c[]= new double[101]; double y[]= new double[101]; int opc[]= new int[101]; int opy[]= new int[101]; int opq[]= new int[101]; double u[][][]=new double[101][3][3]; double ww[][][]=new double[100][3][3]; double v[][][][]=new double[100][3][3][21]; int gotoc[][][][]=new int[100][3][3][21]; int gotoy[][][][]=new int[100][3][3][21]; int gotoq[][][][]=new int[100][3][3][21]; double endv[][]=new double[3][3]; int endc[][]=new int[3][3]; int endy[][]=new int[3][3]; int endq[][]=new int[3][3]; int s; double tl; double tr; double ls; double w; double cs; double ys; double b1; double b2; double tr1; double tr2; double tr3; double wel; double maxwel; double maxtl; double maxtr; int t; int n; int n1; int n2; int pp; int q; int j; double c1; double l1; double h; double u1; int ns1; int ns2; int qx; int nx1; int nx2; double vs; double v1; double maxv; double dc; double dy; int e; double data1[]=new double[101]; double data2[]=new double[201]; prob ton =new prob(); data1=ton.ex1(); linear tool=new linear(); data2=tool.ex2(); for (s=1;s 101;s++){ c[s]=data2[s]; y[s]=data2[s+100]; } for (s=1;s 101;s++){ th[s]=data1[s]; } h=0.001; t=0; while(t 1000){ for (s=1;s 101;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ c1=c[s]+n1*h; l1=(y[s]+n2*h)/th[s]; u1=ux(c1,l1); u[s][n1+1][n2+1]=u1; } } } for (s=1;s 100;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ c1=c[s]+n1*h; l1=(y[s]+n2*h)/th[s+1]; u1=ux(c1,l1); ww[s][n1+1][n2+1]=u1; } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ for (q=-10;q 11;q++){ v[1][n1+1][n2+1][q+10]=-999; } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ q=n2-n1; v[1][n1+1][n2+1][q+10]=u[1][n1+1][n2+1]; } } for (s=2;s 100;s++){ for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ for (q=-10;q 11;q++){ u1=u[s][n1+1][n2+1]; qx=q-n1+n2; pp=0; if (qx 10)pp=100; if (qx -10)pp=100; if (pp 50)qx=0; vs=-999; ns1=0; ns2=0; for (nx1=-1;nx1 2;nx1++){ for (nx2=-1;nx2 2;nx2++){ v1=u1+v[s-1][nx1+1][nx2+1][qx+10]; if (ww[s-1][nx1+1][nx2+1] u1)v1=-999; if (v1 vs)ns1=nx1; if (v1 vs)ns2=nx2; if (v1 vs)vs=v1; } } if (pp 50)vs=-999; gotoc[s][n1+1][n2+1][q+10]=ns1; gotoy[s][n1+1][n2+1][q+10]=ns2; gotoq[s][n1+1][n2+1][q+10]=qx; v[s][n1+1][n2+1][q+10]=vs; } } } } for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ u1=u[100][n1+1][n2+1]; qx=n2-n1; vs=-999; ns1=0; ns2=0; for (nx1=-1;nx1 2;nx1++){ for (nx2=-1;nx2 2;nx2++){ v1=u1+v[99][nx1+1][nx2+1][qx+10]; if (ww[99][nx1+1][nx2+1] u1){ v1=-999; } if (v1 vs){ ns1=nx1; } if (v1 vs){ ns2=nx2; } if (v1 vs){ vs=v1; } } } endc[n1+1][n2+1]=ns1; endy[n1+1][n2+1]=ns2; endq[n1+1][n2+1]=qx; endv[n1+1][n2+1]=vs; } } maxv=-999; ns1=0; ns2=0; for (n1=-1;n1 2;n1++){ for (n2=-1;n2 2;n2++){ if (endv[n1+1][n2+1] maxv){ ns1=n1; } if (endv[n1+1][n2+1] maxv){ ns2=n2; } if (endv[n1+1][n2+1] maxv){ maxv=endv[n1+1][n2+1]; } } } opc[100]=ns1; opy[100]=ns2; opc[99]=endc[opc[100]+1][opy[100]+1]; opy[99]=endy[opc[100]+1][opy[100]+1]; opq[99]=endq[opc[100]+1][opy[100]+1]; for (j=1;j 99;j++){ s=99-j; opc[s]=gotoc[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; opy[s]=gotoy[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; opq[s]=gotoq[s+1][opc[s+1]+1][opy[s+1]+1][opq[s+1]+10]; } e=0; for (s=1;s 101;s++){ e=e+opc[s]*opc[s]+opy[s]*opy[s]; } for (s=1;s 101;s++){ c[s]=c[s]+opc[s]*h; y[s]=y[s]+opy[s]*h; } System.out.println(e); if (e 2){ h=h/2; } if (h 0.00001){ t=10000; } t=t+1; } for (s=1;s 100;s++){ dy=y[s+1]-y[s]; dc=c[s+1]-c[s]; if (dy 0)System.out.println(1-dc/dy); } } static double ux(double c1,double l1){ double up; double c3; double l3; int pp; pp=0; c3=c1; l3=l1; if (c3 0)pp=100; if (l3 0)pp=100; if (l3 1)pp=100; if (pp 50)c3=0.5; if (pp 50)l3=0.5; up=Math.log(c3)+Math.log(1-l3); if (pp 50)up=-999; return up; } }
https://w.atwiki.jp/programming_note/pages/23.html
1. 上から1行づつ処理し、Scriptを実行するため、記載する順番が重要 2. ハッシュデータの加工 - 型(Library 等)への流し込み - 表示が基本 Step1. Libraryを用いた入力データの標準系の定義 Step2. 入力データを加工し、汎用形に流し込む Step3. 読み込み - 出力 # ?? return, write.document $document.ready() etc... return は 引数を定義 write.document() (= puts) により動的なHTMLを生成 イベントバンドラで出力を定義する # ★ユーザー情報に応じた出力ができることがJSのoriginality★ イベントバンドラ 変数/関数の宣言、処理はRuby に似ている 1. 上から1行づつ処理し、Scriptを実行するため、記載する順番が重要 2. ハッシュデータの加工 - 型(Library 等)への流し込み - 表示が基本 data1.series[0].data # データ操作は簡単 Step1. Libraryを用いた入力データの標準系の定義 data = {hash,array} 汎用性ある形にし、 script src = /xxx/xxx.js /script とファイルを外部化し、htmlをシンプルにする Step2. 入力データを加工し、汎用形に流し込む data.series.date[2] = [XX,XX,XX,XX] Step3. 読み込み - 出力 # ?? return, write.document $document.ready() etc... return は 引数を定義 write.document() (= puts) により動的なHTMLを生成 $document( ) イベントバンドラで出力を定義する # ★ユーザー情報に応じた出力ができることがJSのoriginality★ イベントバンドラ onclick ボタンタイプのフォーム要素をサポート input type="" name="" value="" onclick="js statument;" onmousedown, onmouseout onmouseover, onmouseout onchanve onload 変数/関数の宣言、処理はRuby に似ている var data1; data1 = { } var a = new Array() var square = function(x) { return x*x; / * 処理 * / }; document.write(square(10)); var highchart = function (x,y) {return "document.write(" + x*y; + ")"} highchart(19,19);
https://w.atwiki.jp/ce00582/pages/1802.html
class pro{ public static void main(String args[]){ double tl,tr,b1,w1; int n; double th[]=new double[101]; for (n=1;n 101;n++){ th[n]=0.02*n; } tl=0.2; tr=trs(th,tl); System.out.println(tr); } public static double trs(double[] th,double tl){ double tr1,tr2,tr3,b1,b2; int t1; tr1=0.1; tr2=0.2; b1=bud(th,tl,tr1); t1=0; while(t1 100){ b2=bud(th,tl,tr2); tr3=tr2-b2*(tr2-tr1)/(b2-b1); b1=b2; tr1=tr2; tr2=tr3; t1=t1+1; if (b2*b2 0.001)t1=1000; } return tr2; } public static double wel(double[] th,double tl,double tr){ double c1,l1,w1; int n; w1=0; for (n=1;n 101;n++){ c1=cx(th[n],tl,tr); l1=lx(th[n],tl,tr); w1=w1+u(c1,1-l1); } return w1; } public static double bud(double[] th,double tl,double tr){ double c1,y1,b1; int n; b1=0; for (n=1;n 101;n++){ c1=cx(th[n],tl,tr); y1=th[n]*lx(th[n],tl,tr); b1=b1+y1-c1; } return b1; } public static double cx(double th1,double tl,double tr){ double l1,w1,c1; l1=lx(th1,tl,tr); w1=(1-tl)*th1; c1=w1*l1+tr; return c1; } public static double lx(double th1,double tl,double tr){ double w1,l1; w1=(1-tl)*th1; l1=(w1-tr)/(2*w1); if (l1 0)l1=0; return l1; } public static double u(double c1,double x1){ double c2,x2,z2,u2; c2=c1; x2=x1; z2=0; if (c2 0.001)z2=100; if (x2 1)z2=100; if (x2 0)z2=100; if (z2 50)c2=0.01; if (z2 50)x2=0.5; u2=Math.log(c2)+Math.log(x2); if (z2 50)u2=-999; return u2; } }
https://w.atwiki.jp/m_shige1979/pages/549.html
初期設定 ダウンロード このサイトより、ダウンロードを行う(JDK 6 Update 20 (JDK)) http //www.oracle.com/technetwork/java/javase/downloads/index.html インストール 処理 処理 処理 処理